﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace JQueryWidget.WidgetWeb.Modules
{
    public partial class WidgetContainer : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        ContentWidget Widget
        {
            get;
            set;
        }

        protected void EditButton_Click(object sender, EventArgs e)
        {
            Widget.Edit();
            HeaderUpdatePanel.Update();
            WidgetUpdatePanel.Update();
        }

        protected void SaveButton_Click(object sender, EventArgs e)
        {
            Widget.Save();
            HeaderUpdatePanel.Update();
            WidgetUpdatePanel.Update();
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            Widget = Page.LoadControl("~/Modules/ContentWidget.ascx") as ContentWidget;
            WidgetPanel.Controls.Add(Widget);
        }

        public override string ClientID
        {
            get
            {
                return "Container1";
            }
        }

        public override string UniqueID
        {
            get
            {
                return "Container1";
            }
        }
    }
}